import java.io.*;
import java.net.*;

public class HelloWorld {
    public static void main(String[] args) throws Exception {
        String cmd = "python client.py " + args[0] + " " + args[1] + " "+ args[2];

        Process pr = Runtime.getRuntime().exec(cmd);
        BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
        String line2;
        while ((line2 = in.readLine()) != null) {
            System.out.println(line2);
        }
        in.close();
        pr.waitFor();


        File file = new File("out.txt");
        BufferedReader reader = null;
        String tempString = null;
        
        String result = "";
        try {
            reader = new BufferedReader(new FileReader(file));
            while ((tempString = reader.readLine()) != null) {
                result += tempString + "\n";
            }
            reader.close();
            System.out.print(result);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally{
            if(reader != null){
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}